<template>
	<view class="wrap">
		<view class="search">
			<u-search v-model="keywords" @custom="search" @search="search"></u-search>
		</view>
		<u-tabs :list="list" :is-scroll="false" :current="current" @change="change"></u-tabs>
		<view v-if="current === 0">
      <scroll-view class="scroll-list msg-list-item" scroll-y="true">
        <uni-card
          v-for="(item, index) in list0"
          :key="index + '' + item.id"
          :title="item.title"
          :extra="item.time"
          :class="String(item.status) === '1' ? '' : 'item-unread'"
          class="task-list-item" 
          @click.native="handleAction(item)"
          margin="8px">
          <div class="uni-body">
            <div>
              <view class="item-content">{{ item.content }}</view>
            </div>
          </div>
        </uni-card>
        <u-divider>已经到底了</u-divider>
      </scroll-view>
		</view>
		<view v-if="current === 1">
      <scroll-view class="scroll-list msg-list-item" scroll-y="true">
        <uni-card
          v-for="(item, index) in list1"
          :key="index + '' + item.id"
          :title="item.title"
          :extra="item.time"
          :class="String(item.status) === '1' ? '' : 'item-unread'"
          class="task-list-item" 
          @click.native="handleAction(item)"
          margin="8px">
          <div class="uni-body">
            <div>
              <view class="item-content">{{ item.content }}</view>
            </div>
          </div>
        </uni-card>
        <u-divider>已经到底了</u-divider>
      </scroll-view>
		</view>
	</view>
</template>
<script>

export default {
	data() {
		return {
			keywords: '',
			list: [
        {
          name: '处理类'
        },
        {
          name: '阅读类',
        }
      ],
      list0: [
        { title: '计量结算单', time: '2021年10月24日', status: 0, content: '【养护平台消息-日常养护-施工任务单】融河路(G7212)临时任务单测试二级施工单(qzL-rhl-2023-07-003)广西新发展交通集团有限公司董事长超级管理员已接收！' },
        { title: '计量结算单', time: '2021年10月24日', status: 0, content: '【养护平台消息-日常养护-施工任务单】融河路(G7212)临时任务单测试二级施工单(qzL-rhl-2023-07-003)广西新发展交通集团有限公司董事长超级管理员已接收！' }
      ],
      list1: [
        { title: '施工任务单', time: '2021年10月24日', status: 0, content: '【养护平台消息-日常养护-施工任务单】融河路(G7212)临时任务单测试二级施工单(qzL-rhl-2023-07-003)广西新发展交通集团有限公司董事长超级管理员已接收！' },
        { title: '施工任务单', time: '2021年10月24日', status: 0, content: '【养护平台消息-日常养护-施工任务单】融河路(G7212)临时任务单测试二级施工单(qzL-rhl-2023-07-003)广西新发展交通集团有限公司董事长超级管理员已接收！' }
      ],
			current: 0,
			status: 'loadmore',
			iconType: 'circle',
			isDot: false,
			loadText: {
        loadmore: '点击加载更多',
        loading: '正在加载...',
        nomore: '没有更多了'
			}	
		}
	},
	onLoad() {
		
	},
	methods: {
		change(index) {
			this.current = index;
		},
		navTo(url) {
			uni.navigateTo({
				url: url
			});
		},
		search(value) {
			this.$u.toast('搜索内容为：' + value)
		},
    // 显示详细
		handleAction (node) {
      node.status = 1
      this.navTo('/pages/sys/msg/message-detail')
    },
    // 显示详细
		handleShowDetail (node) {
      node.status = 1
      this.navTo('/pages/sys/msg/message-detail')
    }
	}
};

</script>
<style lang="scss">
@import '../../../common/uni.css';
page {
	background-color: #f5f5f5;
}
.wrap .search{
	background: #ffffff;
}
.u-dropdown {
		background: #ffffff;
}
.msg-time{
	font-size: 26rpx;
	padding: 5px 0;
	color: #999999;
	text-align: center;
}
.u-card__foot{
	.u-icon{
		margin-right: 10px;
	}
}
.apply-text{
	font-size: 28rpx;
	color: #333333;
	span{
		color: #999999;
	}
}
.user-images{
	width: 28px;
	height:28px;
	margin-right: 8px;
}
.apply-list-foot{
	font-size: 28rpx;
	justify-content: space-around;
}
.personnel-list{
	display: flex;
	align-items: center;
	flex-wrap:wrap;
	.personnel-user{
		position: relative;
		margin: 5px 9px 0;
	}
	.user-images{
		width: 32px;
		height:32px;
		margin-right:0;
		
	}
	.iconfont{
		position: absolute;
		top:-12px;
		right:-5px;
		color: #FE0100;
	}
}
.agree-text{
	color: #4094ff;
}
.refuse-text{
	color: #ff4400;
}
.task-list-item {
  .item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .item-name {
    display: flex;
    align-items: center;
    font-size: 30rpx;
  }
  .item-time {
    color: #999999;
    font-size: 22rpx;
  }
  .item-content {
    
  }
  &.item-unread {
    /deep/ .uni-card__header-content-title, .item-name, .item-content {
      font-weight: 700;
    }
  }
}
</style>
